Pythagorean Triples

Introduction

Right‑Angled Triangles and the Pythagorean Equation

What Is a Pythagorean Triple?

Famous Examples and Patterns

Primitive vs. Non‑Primitive Triples

Generating Triples by Scaling

A First Method: Trial, Error, and Patterns

A Better Method: Using Algebraic Rearrangements

Rewrite the equation: $$a^2 = c^2 - b^2 = (c-b)(c+b).$$ This suggests:

Euclid’s Formula for All Primitive Triples

For integers $m > n > 0$:

Examples:

Understanding Why Euclid’s Formula Works

Key ideas:

Parity Conditions and Coprimality

To ensure primitiveness:

Classifying All Pythagorean Triples

Every Pythagorean triple is of the form: $$(ka, kb, kc)$$ where $(a,b,c)$ is primitive and generated by Euclid’s formula.

Thus:

This gives a complete classification.

Connections to Geometry and Number Theory

Applications and Historical Notes

Calculator

Coprime

  • Checks if a set of numbers are coprime with each other
    • E.g. if $\gcd(a, b, c) = 1$
coprime(3, 4) coprime([3, 4, 5])

Generating triples

  • We can define a custom function for finding Pythagorean triples
pythagTriple(m, n) = [m^2 - n^2, 2*m*n, m^2 + n^2] pythagTriple(2, 1) pythagTriple(3, 2)

Exercises

Try these to reinforce the ideas:

  1. Verify that $(8,15,17)$ is a Pythagorean triple.

    Solution

    Verify that $(8,15,17)$ is a Pythagorean triple.

    • Compute:
      • $8^2 = 64$
      • $15^2 = 225$
      • $17^2 = 289$
    • Check: $$8^2 + 15^2 = 64 + 225 = 289 = 17^2.$$
    • So $8^2 + 15^2 = 17^2$, and $(8,15,17)$ is a Pythagorean triple.
  2. Determine whether $(9,40,41)$ is primitive.

    Solution

    Determine whether $(9,40,41)$ is primitive.

    • First check it is a triple:
      • $9^2 = 81$
      • $40^2 = 1600$
      • $41^2 = 1681$ $$9^2 + 40^2 = 81 + 1600 = 1681 = 41^2.$$
    • Now check $\gcd(9,40,41)$:
      • $\gcd(9,40) = 1$ (since $9$ is $3^2$ and $40$ has prime factors $2$ and $5$).
      • $\gcd(9,41) = 1$ (41 is prime and not $3$).
      • $\gcd(40,41) = 1$ (consecutive integers).
    • So $\gcd(9,40,41) = 1$, and the triple is primitive.
  3. Generate a triple using Euclid’s formula with $m=5$, $n=2$.

    Solution

    Generate a triple using Euclid’s formula with $m=5$, $n=2$.

    Using: $$a = m^2 - n^2,\quad b = 2mn,\quad c = m^2 + n^2,$$ we get:

    • $a = 5^2 - 2^2 = 25 - 4 = 21$
    • $b = 2 \cdot 5 \cdot 2 = 20$
    • $c = 5^2 + 2^2 = 25 + 4 = 29$

    So $(21,20,29)$ is a Pythagorean triple (often written as $(20,21,29)$).

    Quick check: $$20^2 + 21^2 = 400 + 441 = 841 = 29^2.$$

  4. Find all triples obtained by scaling $(3,4,5)$ with $k=2,3,4$.

    Solution

    Find all triples obtained by scaling $(3,4,5)$ with $k=2,3,4$.

    • For $k=2$: $$(2\cdot 3, 2\cdot 4, 2\cdot 5) = (6,8,10)$$
    • For $k=3$: $$(3\cdot 3, 3\cdot 4, 3\cdot 5) = (9,12,15)$$
    • For $k=4$: $$(4\cdot 3, 4\cdot 4, 4\cdot 5) = (12,16,20)$$

    Each is a Pythagorean triple because $$(k\cdot 3)^2 + (k\cdot 4)^2 = k^2(3^2 + 4^2) = k^2 \cdot 5^2 = (k\cdot 5)^2.$$

  5. Show that if $(a,b,c)$ is primitive, then exactly one of $a$ or $b$ is even.

    Solution

    Show that if $(a,b,c)$ is primitive, then exactly one of $a$ or $b$ is even.

    • Suppose both $a$ and $b$ are odd.
      • Then $a^2 \equiv 1 \pmod{4}$ and $b^2 \equiv 1 \pmod{4}$.
      • So $a^2 + b^2 \equiv 1 + 1 = 2 \pmod{4}$.
      • But any square is $0$ or $1 \pmod{4}$, so $c^2$ cannot be $2 \pmod{4}$—contradiction.
    • Suppose both $a$ and $b$ are even.
      • Then $2$ divides $a$ and $b$, and from $a^2 + b^2 = c^2$, $2$ also divides $c$.
      • So $\gcd(a,b,c) \ge 2$, contradicting primitiveness.
    • Therefore, $a$ and $b$ cannot both be odd or both be even.
    • So exactly one of $a$ or $b$ is even.
  6. Find a pair $(m,n)$ that generates the triple $(7,24,25)$.

    Solution

    Find a pair $(m,n)$ that generates the triple $(7,24,25)$.

    We want: $$a = m^2 - n^2,\quad b = 2mn,\quad c = m^2 + n^2 = 25.$$

    • Solve $m^2 + n^2 = 25$ with integers:
      • Possible pairs: $(m,n) = (4,3)$ or $(3,4)$ (up to sign).
    • Try $m=4$, $n=3$:
      • $m^2 - n^2 = 16 - 9 = 7$
      • $2mn = 2 \cdot 4 \cdot 3 = 24$
    • This matches $(7,24,25)$.

    So one suitable pair is $(m,n) = (4,3)$.

  7. Explain why $m$ and $n$ cannot both be even in Euclid’s formula.

    Solution

    Explain why $m$ and $n$ cannot both be even in Euclid’s formula.

    • If $m$ and $n$ are both even, write $m = 2m'$, $n = 2n'$.
    • Then:
      • $a = m^2 - n^2 = 4m'^2 - 4n'^2 = 4(m'^2 - n'^2)$
      • $b = 2mn = 2 \cdot 2m' \cdot 2n' = 8m'n'$
      • $c = m^2 + n^2 = 4m'^2 + 4n'^2 = 4(m'^2 + n'^2)$
    • So $a$, $b$, and $c$ are all multiples of $4$.
    • Hence $\gcd(a,b,c) \ge 4$, so the triple is not primitive.
    • For generating primitive triples, $m$ and $n$ cannot both be even.
  8. List all primitive triples with $c < 30$.

    Solution

    List all primitive triples with $c < 30$.

    We use Euclid’s formula with $m>n$, $\gcd(m,n)=1$, and opposite parity.

    Check small $m$:

    • $m=2$, $n=1$:
      • $(3,4,5)$, $c=5 < 30$, primitive.
    • $m=3$, $n=2$:
      • $(5,12,13)$, $c=13 < 30$, primitive.
    • $m=4$, $n=1$:
      • $(15,8,17)$ → $(8,15,17)$, $c=17 < 30$, primitive.
    • $m=4$, $n=3$:
      • $\gcd(4,3)=1$, opposite parity:
      • $(7,24,25)$, $c=25 < 30$, primitive.
    • $m=5$, $n=2$:
      • $(21,20,29)$, $c=29 < 30$, primitive.
    • $m=5$, $n=4$:
      • $(9,40,41)$ has $c=41 \ge 30$, so ignore.
    • $m=6$:
      • With $n=1$: $(35,12,37)$, $c=37 \ge 30$.
      • Larger $n$ give even bigger $c$.

    So the primitive triples with $c < 30$ are:

    • $(3,4,5)$
    • $(5,12,13)$
    • $(8,15,17)$
    • $(7,24,25)$
    • $(20,21,29)$

    (You can reorder legs if desired.)

  9. Prove that $c$ is always odd in a primitive triple.

    Solution

    Prove that $c$ is always odd in a primitive triple.

    Let $(a,b,c)$ be primitive with $a^2 + b^2 = c^2$.

    • From Exercise 5, exactly one of $a$ or $b$ is even.
      • So one is even, one is odd.
    • Then:
      • Even square $\equiv 0 \pmod{4}$.
      • Odd square $\equiv 1 \pmod{4}$.
    • So $a^2 + b^2 \equiv 0 + 1 = 1 \pmod{4}$.
    • Hence $c^2 \equiv 1 \pmod{4}$.
    • The only integers with square $\equiv 1 \pmod{4}$ are odd integers.
    • Therefore, $c$ must be odd.

    10. Challenge: Find a triple where the legs differ by $1$ (i.e., $b = a+1$).

    We want integers $a$ and $c$ such that: $$a^2 + (a+1)^2 = c^2.$$

    • Expand: $$a^2 + a^2 + 2a + 1 = c^2$$ $$2a^2 + 2a + 1 = c^2.$$
    • Try small $a$:
      • $a=3$: $2\cdot 9 + 6 + 1 = 18 + 6 + 1 = 25 = 5^2$.
    • So $a=3$, $b=4$, $c=5$ works.

    Thus $(3,4,5)$ is a Pythagorean triple whose legs differ by $1$.

  10. Challenge: Find a triple where the legs differ by $1$ (i.e., $b=a+1$).